home *** CD-ROM | disk | FTP | other *** search
- Path: conan.ids.net!scarney
- From: scarney@conan.ids.net (scarney)
- Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.perl
- Subject: Stupid array problems
- Date: 13 Jan 1996 22:21:51 GMT
- Organization: IDS World Network Internet Access Service, (401) 885-4243
- Message-ID: <4d9b9v$14n@paperboy.ids.net>
- NNTP-Posting-Host: conan.ids.net
-
- Ok, I've been having what I thought would be a simple problem but no one
- seems to quite figure out. I Have an array of strings, both the key and
- the string being pointers. Putting information onto the array is like a
- stack. My problem comes in the removal of information from it. Popping
- from a stack only pulls the lastelement out of the array, I want to pull
- any element out. Destroying the data isn't the hard part because I just
- blow up the pointers...the problem is that the indexing for the array
- gets kind of screwy. If I have an array organized by integers with
- elements 1 2 3 4 5 6 7 8, if I decided to kill element #4 I'm going to
- have an array of 1 2 3 5 6 7 8, and as time goes on its going to get more
- screwy. Is there an easy way to delete an element while preserving some
- semblance of sequence in the array indexing? In Perl I'd use the splice()
- command...is there anything similar in C/C++?
-
- I get the feeling I'm looking at this from a completely wrong
- perspective, so don't flame me if I am...
-
- Thanks.
- -Seth
-
-